package com.sendi.sql;

import java.util.ArrayList;

public class FieldInf {
	/*
	 * 字段名称,也是主键
	 */
	private String fieldname;
	/*
	 * 字段解析
	 */
 	private String fieldcomment;
	
	private boolean isGrouby;
	
	/*
	 * 排序类型，默认为asc
	 */
	private String groupbyType="asc";
	
	/*
	 * 字段的数据类型，支持INT,LONG,DOUBLE,FLOAT,DATE,STRING
	 */
	private String fieldType;
	/*
	 * 只有isGrouby=false时，才有GroupByAction的作用
	 */
	private int GroupByAction;
	
	/*
	 * 当有GroupByAction时，统计出来的结果接收的字段，如果求filed1 的最大值，求到最大值用哪个字段接收，如用field3
	 */
	private String GroupByActionAcceptField;
	
	/*
	 * 当有GroupByAction时，另外指向的字段,用反射调用方法实现赋值,是一些方法名称,之所以这样，是为了有的统计值需要运算后得出的原因
	 */
	private ArrayList<String> GroupByActionPointMethod;
	/*
	 * 当有GroupByAction时，另外指向的字段的，主要是为了copy值是所用,此处是包括GroupByActionAcceptField所指向的字段
	 */
	private ArrayList<FieldInf> GroupByActionPointFiledobj;
	/*
	 * 当有GroupByAction时，另外指向的字段的，作用是生成GroupByActionPointFiledobj，包括GroupByActionAcceptField
	 */
	private String [] GroupByActionPointfield;
	
	/*
	 * 当统计动作为CountAction时，做的一种特殊处理,distinct，field1,field2 ..这后面为字段CountAction字段，也就是在startindex 到endindex中，只有这两个字段加起来不相同时，才加1
	这些字段必须为string类型
	 */
	private String countdetail;

	/*
	 * 通过传入字段分隔的方法名，加入到GroupByActionPointFiled
	 */
	public void setGroupByActionPointMethod(String GroupByActionPointMethods)
	{
		if(GroupByActionPointMethods!=null&&GroupByActionPointMethods.length()>0)
		{
			String f[]=GroupByActionPointMethods.split(",");
			if(f.length>0)
			{
				if(GroupByActionPointMethod==null)
					GroupByActionPointMethod=new ArrayList<String>();
				for(String a:f)
				{
					GroupByActionPointMethod.add(a);
				}
			}
		}
	
	}
	public String getFieldname() {
		return fieldname;
	}

	public void setFieldname(String fieldname) {
		this.fieldname = fieldname;
	}

	public String getFieldcomment() {
		return fieldcomment;
	}

	public void setFieldcomment(String fieldcomment) {
		this.fieldcomment = fieldcomment;
	}

	public boolean isGrouby() {
		return isGrouby;
	}

	public void setGrouby(boolean isGrouby) {
		this.isGrouby = isGrouby;
	}

	public String getGroupbyType() {
		return groupbyType;
	}

	public void setGroupbyType(String groupbyType) {
		this.groupbyType = groupbyType;
	}

	public String getFieldType() {
		return fieldType;
	}

	public void setFieldType(String fieldType) {
		this.fieldType = fieldType;
	}

	public int getGroupByAction() {
		return GroupByAction;
	}

	public void setGroupByAction(int groupByAction) {
		GroupByAction = groupByAction;
	}

	public ArrayList<String> getGroupByActionPointMethod() {
		return GroupByActionPointMethod;
	}

	public void setGroupByActionPointMethod(ArrayList<String> groupByActionPointFiled) {
		GroupByActionPointMethod = groupByActionPointFiled;
	}
	
	public void setGroupByActionAcceptField(String groupByActionAcceptField) {
		GroupByActionAcceptField = groupByActionAcceptField;
	}
	public String getGroupByActionAcceptField() {
		return GroupByActionAcceptField;
	}
	 
	public void setGroupByActionPointFiledobj(
			ArrayList<FieldInf> groupByActionPointFiledobj) {
		GroupByActionPointFiledobj = groupByActionPointFiledobj;
	}
	public ArrayList<FieldInf> getGroupByActionPointFiledobj() {
		return GroupByActionPointFiledobj;
	}
	public void setGroupByActionPointfield(String[] groupByActionPointfield) {
		GroupByActionPointfield = groupByActionPointfield;
	}
	public void setGroupByActionPointfield(String groupByActionPointfield) {
		if(groupByActionPointfield!=null&&groupByActionPointfield.trim().length()>0)
		{
			GroupByActionPointfield = groupByActionPointfield.split(",");
		}
		else
		{
			GroupByActionPointfield=new String[0];
		}
		
		
	}
	public String[] getGroupByActionPointfield() {
		return GroupByActionPointfield;
	}
	public String getCountdetail() {
		return countdetail;
	}
	public void setCountdetail(String countdetail) {
		this.countdetail = countdetail;
	}
	
	
}
